﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace My.EntityFrameworkCore.EntityFrameworkCore
{
    public class DefaultDbContextFactory : IDesignTimeDbContextFactory<DefaultDbContext>
    {
        public DefaultDbContext CreateDbContext(string[] args)
        {
            var builder = new DbContextOptionsBuilder<DefaultDbContext>().UseMySql(
                connectionString: "Database=MyWebApi;Data Source=localhost;Port=3306;User Id=root;Password=123456;Charset=utf8",
                ServerVersion.Parse("8.4.0")).UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
            return new DefaultDbContext(builder.Options);
        }
    }
}
